package com.beordie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.beordie.dao.RouteDao;
import com.beordie.model.Category;
import com.beordie.model.Route;
import com.beordie.service.IRouteService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 路程服务层实现类
 * @Date 2021/8/5 20:31
 * @Created 30500
 */
@Service
public class RouteServiceImpl implements IRouteService {
    @Resource
    private RouteDao routeDao;

    @Override
    public PageInfo<Route> findPage(Route route, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Route> routeList = routeDao.selectPage(route);
        return new PageInfo<>(routeList);
    }

    @Override
    public List<Route> find() {
        List<Route> routeList = routeDao.selectPage(null);
        return routeList;
    }

    @Override
    public int add(Route route) {
        return routeDao.insert(route);
    }

    @Override
    public Route findById(Integer id) {
        return routeDao.selectById(id);
    }

    @Override
    public int update(Route route) {
        return routeDao.updateById(route);
    }

    @Override
    public int delete(Integer id) {
        return routeDao.deleteById(id);
    }
}
